fix(humanize): tolerate moving targets after scroll - #355
Conversation
|
Thanks for digging into this, and for the clean, well scoped patch. We reproduced #329 before reviewing, then ran your change against it. Sharing the results because they point somewhere unexpected. The test page puts a button below the fold and grows content above it every 50ms, so the button drifts continuously at roughly 60px/s. Same page, four cases: Two findings. First, the click still fails with the patch applied. Second, and this is what changed our mind about the underlying issue. The cause is structural. So on a page that never settles, the element genuinely cannot be clicked at human speed, and the existing exception is reporting that correctly. If the region does eventually settle, clicking it normally already works. page._original.click("div.show-more")We measured that at 0.1s on the never settling page. Given all that, we are going to decline this one. Where we think the real gap is: the error message says what failed but not what to do about it. |
|
Following up, because my earlier comment got the explanation wrong. I said the stability check is what stands between the user and a silent misclick. It is not. After instrumenting the pipeline, the real cause sits two lines from where this PR was looking. We scroll the element into view, then wait for it to settle, and never scroll again. On a reflowing page the element gets pushed off screen during that wait, so we click at coordinates outside the viewport and hit nothing. Measured on So your instinct about this area was right. The stability check firing is a symptom of exactly the pages the real bug affects. Fix is in #468. A review from you would be welcome. Two retractions. The decline still holds on the measurements, this patch still fails and replaces a useful message with |
Fixes #329.
Summary
Verification
cd js && npm test -- humanize.test.tscd js && npm run typecheckpython -m pytest tests/test_humanize_unit.py::TestPerCallTimeoutForwarding tests/test_humanize_unit.py::TestPostScrollStability tests/test_humanize_unit.py::TestPointerEventsFailOpen::test_handle_failopen_returns_on_evaluate_error tests/test_humanize_unit.py::TestPointerEventsFailOpen::test_locator_failopen_returns_on_evaluate_error tests/test_humanize_unit.py::TestPointerEventsFailOpen::test_handle_still_raises_when_covered -qNote: full
tests/test_humanize_unit.pyis not clean in this local environment becausepytest-asynciois unavailable and several existing tests launch real browsers or hit external pages.